import requests
from config import url, headers_web

class CourseResourceStatistics:

    def __int__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def courseresource_detail(cls, url: str, params=None,headers = headers_web):
        '''
        @Summary:课程资源统计接口
        @Description:1.大数据平台-课程资源分类统计
        :param url:
        :param params:
        :return:
        '''
        url = url + "/courseApi/api/v1/courseresource/detail/statistics"
        r = requests.get(url=url,headers=headers,params=params)
        return r
    @classmethod
    def courseresource_use(cls, url: str , params=None,headers = headers_web):
        '''
        @Summary:课程资源使用统计接口
        @Description:1.大数据平台-资源使用情况统计使用
        :param url:
        :param params:
        :return:
        '''
        url = url + "/courseApi/api/v1/courseresource/use/statistics"
        r = requests.get(url=url, headers=headers, params=params)
        return r

if __name__ == '__main__':
    from common.hashlib_utils import hash_md5

    valid_code = hash_md5("&signKey=123123")
    # resp = CourseResourceStatistics.courseresource_detail(url,params={
    #     "validCode": valid_code
    # })
    resp = CourseResourceStatistics.courseresource_use(url,params={
        "validCode": valid_code
    })
    print(resp.url, "\n", resp, resp.content)
    print(resp.request.headers, "\n", resp.request.method)


